﻿using System;
using System.Web;
using System.IO;
using System.Drawing;
using Intorise.API;
using Newtonsoft.Json;
using System.Collections.Generic;

/// <summary>
/// 
/// </summary>
public abstract class CommonHandler : IHttpHandler
{
    static CommonHandler()
    {

    }

    protected void WriteResultJson(object entity, Newtonsoft.Json.JsonSerializerSettings settings = null)
    {
        if (settings == null)
        {
            try
            {
                HttpContext.Current.Response.Write(JsonConvert.SerializeObject(entity));
            }
            catch (Exception ex)
            {

            }
        }
        else
        {
            HttpContext.Current.Response.Write(JsonConvert.SerializeObject(entity, settings));
        }
    }

    public bool IsReusable
    {
        get { return false; }
    }

    public virtual void ProcessRequest(HttpContext context) { }
}